<?php
namespace app\index\controller;

use think\Controller;
use app\index\model\Article as ArticleModel;
use app\index\model\Cate as CateModel;

class Index extends Typez
{

    // 首页显示内容
    public function index()
    {
        $article = new ArticleModel();
        $cate = new CateModel();
        $articleres = $article->getarticle_tui(1); //最新文章
        $articleres_qi = $article->getarticle_qi(1); //其他文章
        $cateres = $cate->getcate(1); //历史分类
        $banner = db('banner')->where('status', 1)->select(); //轮播图
        $sift_art = db('sift_art')->find();
//        $sift_art['content'] = substr($sift_art['content'],0, 890);
        $sift_banner = db('sift_banner')->select();
        $this->assign(array(
            'artres' => $articleres,
            'cateres' => $cateres,
            'artres_qi' => $articleres_qi,
            'banner' => $banner,
            'sift_art' => $sift_art,
            'sift_banner' => $sift_banner
        ));
        return view();
    }

    public function lay(){
        $catez = new CateModel();
        $cateresz = $catez->getcate(2); //历史分类
        $this->assign(array(
            'cateresz' => $cateresz
        ));
        return view('public/top');
    }
}
